package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.widget.view.AutofitImageView;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Good;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.main.Follow;

/**
 * Created by Administrator on 2016/3/12 0012.
 */
public class FollowAdapter extends ItemAdapter<Follow,FollowAdapter.FollowHolder> {
    private Context context;
    public FollowAdapter(Context context) {
        super(context);
        this.context=context;
    }

    @Override
    public FollowHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new FollowHolder(inflate(R.layout.item_follow, parent));
    }

    @Override
    public void onBindViewHolder(FollowHolder holder, int position) {
        Follow item = getItem(position);
        Glide.with(context).load(item.image).into(holder.imgGood);
        holder.txtTitle.setText(item.title);
        holder.txtContent.setText(item.content);
    }

    static class FollowHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        @BindView(R.id.img_shop)
        AutofitImageView imgGood;
        @BindView(R.id.txt_title)
        TextView txtTitle;
        @BindView(R.id.txt_content)
        TextView txtContent;

        public FollowHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {

        }
    }
}
